﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="../Shared/Site.master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<User>>" %>
<%@ Import Namespace="Oxite.Infrastructure"%>
<%@ Import Namespace="Oxite.Models.Extensions" %>
<%@ Import Namespace="ECube.SEC.Membership.Models" %>
<%@ Import Namespace="ECube.SEC.Models" %>
<asp:Content ID="Content4" ContentPlaceHolderID="HeadCssFiles" runat="server">
<link href='<%= Url.Content(@"~/Scripts/jquery.ui/themes/ui-lightness/jquery.ui.all.css") %>' rel="stylesheet" type="text/css" />
<style type="text/css">
    .ui-button{margin: 2px 4px;padding: 2px;text-decoration: none;cursor: pointer;position: relative;text-align: center;}
    .ui-dialog .ui-state-highlight, 
    .ui-dialog .ui-state-error{padding: 4px;}
    .portlet{padding: 10px;}
    .portlet-header{padding: 4px;margin-bottom: 6px;}
</style>
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="HeadScripts" runat="server">
<script src="<%= Url.Content("~/Scripts/jquery.form.js") %>" type="text/javascript"></script>
<script src="<%= Url.Content(@"~/Scripts/jquery.ui/ui/jquery-ui-1.8.custom.js") %>" type="text/javascript"></script>
<script src="<%= Url.Content(@"~/Scripts/jsTree/jquery.tree.js") %>" type="text/javascript"></script>
</asp:Content>

<asp:Content ContentPlaceHolderID="MainContent" runat="server">
<div style="margin-right:0.7em;">
<div class="portlet-header ui-widget-header ui-corner-all">用户管理</div>
<div class="ui-widget" style="margin:10px 0px;">
    <div class="ui-state-highlight ui-corner-all">
        <p style="margin:0px; padding:3px;"><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
            <%= Html.PageTitle(ViewData["Title"] as string ?? "","用户管理") %>
        </p>
    </div>    
</div>

    <div style="margin:10px 0px;">
        <button id="btn-adduser" class="ui-button ui-state-default ui-corner-all"> 增加用户 </button>  
        <button id="btn-removeuser" class="ui-button ui-state-default ui-corner-all"> 移除用户 </button>      
        <button id="btn-disableuser" class="ui-button ui-state-default ui-corner-all"> 禁用用户 </button>     
    </div>
    
    <div class="ui-widget-content ui-corner-all" style="width:25%;float:left;padding:5px 0px;">
         <div style="margin-left:5px;">搜索</div>
         <div >kkk</div>
    </div>
    <div style="width:73.5%;float:right;">
    <table cellpadding="0" cellspacing="0" border="0" class="display" id="userList">
	    <thead>
		    <tr>
			    <th width="20%">帐号</th>
			    <th width="25%">显示名称</th>
			    <th width="25%">Email</th>
			    <th width="15%">描述</th>
		    </tr>
	    </thead>
	    <tbody>	
	    <%if (Model.Count() < 1)
       { %>
		<tr>
			<td colspan="4" class="dataTables_empty">无数据！</td>
		</tr>
		<%}
       else
       {
           foreach (User u in Model)
           { %>
           <tr>
           <td><%= u.Name %></td>
           <td><%= u.DisplayName %></td>
           <td><%= u.Email %></td>
           <td><%= u.Status %></td>
           </tr>       
		<%}
       } %>>
	    </tbody>
    </table>
  </div>

</div>

<div id="aduserDialog">
<%//Html.RenderPartialFromSkin("ADUsers",new ADConnect()); %>
</div>
</asp:Content>

<asp:Content ContentPlaceHolderID="Title" runat="server">
   <%=Html.PageTitle(Html.Localize("Admin"), Html.Localize("Users.Manage", "Manage User")) %> 
   
</asp:Content>

<asp:Content ContentPlaceHolderID="Scripts" runat="server">
<script type="text/javascript">
    $(document).ready(function() {
        $('#aduserDialog').dialog({ autoOpen: false });
        $('#userList').dataTable({
            "bJQueryUI": true,
            "sPaginationType": "full_numbers",
            "bProcessing": true,
            "bServerSide": true,
            "sAjaxSource": ""//,
            // "fnServerData": getAdUsers
        });
        $("#btn-adduser").button().click(function() {
        $.post(
       "<%=Url.Action("ADUsers", "User")%>","",
        function(result){
           $('#aduserDialog').html(result);
        });
            $('#aduserDialog').dialog('open');
        });
        $("#btn-removeuser").button();
        $("#btn-disableuser").button();
    });
</script>
</asp:Content>